﻿// zxCheckProjectPropertyDialog.cpp: 实现文件
//

#include "stdafx.h"
#include "zxCheckProjectPropertyDialog.h"
#include "afxdialogex.h"
#include "Resource.h"


// zxCheckProjectPropertyDialog 对话框

IMPLEMENT_DYNAMIC(zxCheckProjectPropertyDialog, CDialogEx)

zxCheckProjectPropertyDialog::zxCheckProjectPropertyDialog(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_ZX_CHECK_PROJECT_PROPERTY, pParent)
{

}

zxCheckProjectPropertyDialog::~zxCheckProjectPropertyDialog()
{
}

void zxCheckProjectPropertyDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MFCPROPERTYGRID1, m_props);
}


BEGIN_MESSAGE_MAP(zxCheckProjectPropertyDialog, CDialogEx)
END_MESSAGE_MAP()


// zxCheckProjectPropertyDialog 消息处理程序


BOOL zxCheckProjectPropertyDialog::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
	if (m_pProject)
	{
		m_props.Populate(m_pProject);
	}

	AdjustLayout();

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}

void zxCheckProjectPropertyDialog::AdjustLayout()
{
	CWnd* pWnd = GetDlgItem(IDC_STATIC_PROPS);
	if (pWnd)
	{
		CRect rect;
		GetDlgItem(IDC_STATIC_PROPS)->GetWindowRect(rect);
		ScreenToClient(rect);
		int margin = 2;
		rect.left += margin;
		rect.right -= margin;
		rect.top += margin;
		rect.bottom -= margin;
		m_props.MoveWindow(rect);
	}
}

void zxCheckProjectPropertyDialog::SetProject(ck::CheckProject* pProject)
{
	m_pProject = pProject;
}
